import { onLoad } from '@dcloudio/uni-app'
import { detailApi } from '@/apis/task.js'
import { ref } from 'vue'
export const useDetail = () => {
	// 1. 任务详情数据
	const taskDetail = ref({})
	// 2. 获取任务详情数据
	const getDetail = async (id) => {
		const { data } = await detailApi(id)
		console.log('任务详情数据：', data)
		taskDetail.value = data
	}
	// 获取地址参数=》只能在 onLoad
	onLoad((params) => {
		console.log('任务 id：', params.id)
		getDetail(params.id)
	})

	return { taskDetail, getDetail }
}